import {View, Button, Text, Image, ScrollView} from '@tarojs/components';
import Taro from '@tarojs/taro';
import React from 'react';
import {connect} from 'react-redux';
import * as T from '../../types';
import './index.less';
import actions from '../../actions';
import {store2Props} from '../../selectors';
import testImg from '@/assets/image/ipland/test.png';
import receive from '@/assets/image/ipland/receive.png';
import {IMAGE_EMPTY} from '../../constant';

//@ts-ignore
actions().actions.loadReducer();
//@ts-ignore
@connect<Partial<T.IProps>, any>(store2Props, actions)
export default class toBeCollected extends React.Component<Partial<T.IProps>, any> {
  constructor(props) {
    super(props);
    this.state = {};
  }

  render() {
    let {
      item,
      i,
      actions: {action},
    } = this.props;
    if (!item) return null;
    return (
      <View className="toBeCollected">
        <View className="toBeCollected-left">
          <Image className="toBeCollected-img" src={item.goodsInfoImg || IMAGE_EMPTY} mode="aspectFit" />
          <View className="toBeCollected-info">
            <Text className="toBeCollected-info-name">{item.goodsInfoName}</Text>
            <Text className="toBeCollected-info-price1">市场价：￥{item.price || '0'}</Text>
            <Text className="toBeCollected-info-price2">实付￥0</Text>
          </View>
        </View>
        <View className="toBeCollected-controll">
          <Text
            className="setOrder"
            onClick={() => {
              action.check(item, i);
            }}
          >
            领取
          </Text>
          {/* <Image className="toBeCollected-controll-btn" src={receive} mode="widthFix" /> */}
          <Text className="toBeCollected-controll-tip">还有{item.endDay}天到期</Text>
        </View>
      </View>
    );
  }
}

//create by moon https://github.com/creasy2010/moon
